namespace jsWrite {
    interface prop {
    configurable?:boolean,
    enumerable?:boolean,
    value?:any,
    writable?:boolean,
    get?:()=>any,
    set?:(newValue?:any)=>void
}
interface properties {
    readonly [index:string | symbol]:prop
}
function myCreate(obj:object,propertiesObject?:properties):object{
    function F():void{}          
    F.prototype = obj
    const instance = new (F as any)
    if(propertiesObject){
        Object.defineProperties(instance,propertiesObject)
    }
    return instance
}

let obj = {a:1}
Object.defineProperty(obj,'a',{
    writable:false,
    value:2
})
let obj2 = Object.getPrototypeOf(myCreate(obj,Object.getOwnPropertyDescriptors(obj)))
console.log(obj2);
console.log(Object.getOwnPropertyDescriptors(obj2));
}